import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { PwdManagementService } from './pwd-management.service';
import { CreatePwdManagementDto } from './dto/create-pwd-management.dto';
import { UpdatePwdManagementDto } from './dto/update-pwd-management.dto';

@Controller('pwd-management')
export class PwdManagementController {
    constructor(private readonly pwdManagementService: PwdManagementService) { }

    @Post()
    create(@Body() createPwdManagementDto: CreatePwdManagementDto) {
        return this.pwdManagementService.create(createPwdManagementDto);
    }

    @Post('/query')
    create1(@Body() body: { keyword: string, pageNo: number, pageSize: number }) {
        return this.pwdManagementService.findAll(body);
    }

    @Get()
    findAll(@Query() query: { keyword: string, pageNo: number, pageSize: number }) {
        return this.pwdManagementService.findAll(query);
    }

    @Get(':id')
    findOne(@Param('id') id: string) {
        return this.pwdManagementService.findOne(+id);
    }

    @Patch(':id')
    update(@Param('id') id: string, @Body() updatePwdManagementDto: UpdatePwdManagementDto) {
        return this.pwdManagementService.update(+id, updatePwdManagementDto);
    }

    @Delete(':id')
    remove(@Param('id') id: string) {
        return this.pwdManagementService.remove(+id);
    }
}
